<?php
require 'cabesario.php';
include 'model/Activity.php';
if (isset($_SESSION["autenticacao"])) {
    if ($_SESSION['autenticacao'] == "ok") {
        $user = $_SESSION['usuario'];
        $activity = new Activity();
        $activitys = $activity->selectByUser($user->getId());
        ?>
        <a  href="activity.php" class="style_button">Nova Atividade</a></br>
        <?php
        if (count($activitys) > 0) {
            foreach ($activitys as $key => $a) {
                $data = $a->printData(). ' - '.$a->getHora();
                $description = $a->getDescription() . " - " . $a->getLocal();
                ?><a href="activity.php?edit=<?php echo $a->getId() ?>" title="Editar">
                    <div id="contact">
                        <div class="name"><?php echo $data ?></div>
                        <div class="description"><?php echo $description ?></div>
                    </div>
                </a>
                <?php
            }
        } else {
            echo'<div id="message" class="info">Nenhum contato encontrado</div>';
        }
    }
} else {
    header("location: index.php");
}require 'rodape.php';
?>
<script src="js/jquery.maskedinput.js"></script> 